import xlrd

path = './src/data.xls'
book = xlrd.open_workbook(path)
sheet = book.sheet_by_index(0)

yd_list = (
	'134', '135', '136', '137', '138', '139', '147', '150', '151',
	'152', '157', '158', '159', '178', '182', '183', '184', '187',
	'188', '1703', '1705', '1706'
)
lt_list = (
	'130', '131', '132', '145', '155', '156', '175', '176', '185',
	'186', '1704', '1707', '1708', '1709', '171'
)
dx_list = (
	'133', '149', '153', '173', '177', '180', '181', '189', '1700',
	'1701', '1702'
)

gw_list = ('黑龙江', '北京', '福建', '四川')

yd_count = 0
lt_count = 0
dx_count = 0

male_count = 0
female_count = 0

over45_count = 0

high_count = 0
low_count = 0

cm_count = 0

gw_count = 0

index = 0
for i in range(sheet.nrows):
	if index == 0:
		index += 1
		continue

	if str(sheet.cell_value(i, 5)).startswith(yd_list):
		yd_count += 1
	elif str(sheet.cell_value(i, 5)).startswith(lt_list):
		lt_count += 1
	elif str(sheet.cell_value(i, 5)).startswith(dx_list):
		dx_count += 1

	if str(sheet.cell_value(i, 8)) == '男':
		male_count += 1
	elif str(sheet.cell_value(i, 8)) == '女':
		female_count += 1	

	if int(sheet.cell_value(i, 7)) > 45:
		over45_count += 1

	if int(sheet.cell_value(i, 11)) > 8000:
		high_count += 1
	elif int(sheet.cell_value(i, 11)) < 3000:
		low_count += 1
	
	
	if str(sheet.cell_value(i, 13)).find('传媒') != -1:
		cm_count += 1

	if str(sheet.cell_value(i, 9)).startswith(gw_list):
		gw_count += 1
		

print(f"表格中共有{sheet.nrows-1}人")

print(f"移动用户有{yd_count}人")
print(f"联通用户有{lt_count}人")
print(f"电信用户有{dx_count}人")

print(f"男性用户有{male_count}人")
print(f"女性用户有{female_count}人")

print(f"超过45岁的有{over45_count}人")

print(f"高薪人员有{high_count}人")
print(f"低薪人员有{low_count}人")

print(f"去传媒公司工作的有{cm_count}人")

print(f"可能在疫情高危地区的有{gw_count}人")